const device = require('../util/device');
const logger = require('../util/log')

const TAG = 'OPUS';

async function handleOPUS(socket, request, event){
    const { type, state } = event;

    switch (state){
        case 'start':
            handleListen(socket, request, event);
            break;
        case 'stop':
            handleStop(socket, request, event);
            break;
    }
}

async function handleListen(socket, request, event) {
    const { session_id, mode } = event;

    logger.log(TAG, `listen: ${device.getReqIP(request)},${device.getReqIDs(request)}, payload: ${JSON.stringify(event)}`)
}

async function handleStop(socket, request, event) {
    const { session_id } = event;

    logger.log(TAG, `stop: ${device.getReqIP(request)},${device.getReqIDs(request)}, payload: ${JSON.stringify(event)}`)
}

async function handleAudio(){
    
}

module.exports = {
    handleOPUS
}